# testlist = [{"id":1,'name':'用户管理',"pid":1,'pname':"菜单管理"},{"id":2,'name':'用户22管理',"pid":1,'pname':"菜单管理"}]

# #定义两个列表
# #一个列表存放pid
# idlist=[]
# #一个列表存放菜单数据 son权限数据
# reslist=[]
# # reslist = [{"id":1,"name":"菜单管理","son":[{"id":1,'name':'用户管理'},{"id":2,'name':'用户22管理'}]}]
# for i in testlist:
#     if i['pid'] not in idlist:
#         reslist.append({"id":i['pid'],"name":i['pname'],"son":[{"id":i['id'],'name':i['name']}]})
#         idlist.append(i['pid'])
#     else:
#         index = idlist.index(i['pid'])
#         reslist[index]['son'].append({"id":i['id'],'name':i['name']})

# print(reslist)
str= "1:5,2:3,3:8"
res = str.split(",")

dict = {i.split(":")[0]:i.split(":")[1] for i in res}
for i in dict.items():
    print(i)
list = sorted(dict.items(),key=lambda item:item[1])
print(list)
# print(res)
# dict = {i.split(":")[0]:i.split(":")[1] for i in res}
# # for k,v in dict.items():
# #     # print(k)
# #     print(v)
# a = sorted(dict.items(), key=lambda x: x[0])
# print(a)
# list = [i[0] for i in a]
# print(list)


